#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int main()
{
	for (int i = 0; i <= 100000; ++i)
	{
		int arr[6] = { 0 };
		int wei = 1,sum = i,ret=i;
		while (ret / 10 != 0)
		{
			arr[wei - 1] = ret % 10;
			wei++;
			ret/= 10;
		}
		arr[wei - 1] = ret;
		for (int j = 1; j <= wei; ++j)
		{
			sum -= pow(arr[j - 1], wei);
		}
		if (sum == 0)
		{
			printf("%d ", i);
		}
	}
	return 0;
}